tour <- read_csv("tour.csv", col_names = FALSE) %>%
rename("Year"=X1,"Location"=X2,"Count"=X3)
lo<- function(x) {str_replace_all(x,"合計","地區")}
tour <- tour %>%
mutate(Location=lo(Location))
## 各大洲旅遊人數
tour_continent <- tour %>%
filter(grepl("地區",Location)) %>%
filter(!grepl("其他地區",Location))
## 各大洲旅遊人數比較
ggplot(tour_continent,mapping = aes(x=Year, y=Count))+
geom_point(mapping = aes(color=Location))+
scale_x_continuous(breaks=69:104)
## 旅遊總人數
non_region <- tour %>%
filter(!grepl("地區",Location))
other_region <- tour %>%
filter(grepl("其他地區",Location))
tour_total <- bind_rows(non_region, other_region) %>%
group_by(Year) %>%
summarise(Total=sum(Count,na.rm = TRUE))
## 各大洲+總人數
ggplot()+
geom_line(data=tour_continent,mapping = aes(x=Year,y=Count,color=Location))+
geom_line(data=tour_total, mapping=aes(x=Year,y=Total,color="總人數"))+
scale_x_continuous(limits=c(75,104),breaks=75:104)
92年觀光人數下降,亞洲尤其明顯,所以先看看亞洲
tour_asia_country <- tour %>%
filter(grepl("中國|日本|韓國|香港|亞洲地區|菲律賓|新加坡|馬來西亞|泰國|印尼|汶萊|越南|澳門|緬甸",Location))
gp=ggplot(tour_asia_country,mapping = aes(x=Year, y=Count))+
geom_line(mapping = aes(color=Location))+
scale_x_continuous(limits=c(75,104) ,breaks=75:104)+
scale_y_continuous(breaks=seq(0, 12000000, by=1000000))
ggplotly(gp)
此圖為互動式,可多試試右上角的功能鍵
推測這下跌應與某大事件的發生有關。查詢維基百科2003年臺灣,發現其很有可能與SARS於亞洲地區,特別是臺灣與中國大陸的爆發有關。
民國92年旅遊人數明顯下降,可說是暴跌的程度。其原因應與SARS在中國大陸、香港、澳門及臺灣的爆發有關。
綜上所述,應能確定造成92年旅遊人數下降的因素為SARS疫情爆發。